//
//  UIImage+Y2Common.h
//  Y2Common
//
//  Created by Mac on 2021/6/2.
//

#import <UIKit/UIKit.h>

@interface UIImage (Y2Common)

/// 补全图片的路径名，用于加载bundle中的图片
+(NSString *) y2ImageNameByBoundleName:(NSString *)boundleName
                              imageName:(NSString *)imageName;

/// 动态拉伸
+(UIImage *) y2ResizeWithImage:(UIImage *) image;

/// 动态拉伸
+(UIImage *) y2ResizeWithImage:(UIImage *)image leftMargin:(CGFloat)lm rightMargin:(CGFloat)rm topMargin:(CGFloat)tm bottomMargin:(CGFloat)bm;

/// 横向平铺拉伸
+(UIImage *) y2ResizeTileWithImage:(UIImage *)image;

/// 横向平铺拉伸
+(UIImage *) y2ResizeTileWithImage:(UIImage *)image leftMargin:(CGFloat)lm rightMargin:(CGFloat)rm topMargin:(CGFloat)tm bottomMargin:(CGFloat)bm;

/// 等比尺寸缩放图片(@deprecated)
+(UIImage *) y2ImageCompress:(UIImage*)image scale:(float)scale;

/// 缩放图片到指定尺寸
+(UIImage *) y2ScaleWithImage:(UIImage*)image targetSize:(CGSize)size;

/// 先压缩图片质量，再压缩图片尺寸，直到图片小于指定大小
+(UIImage *) y2CompressWithImage:(UIImage*)image maxSize:(CGFloat)maxSize;

/// 合成两张图片
+(UIImage *) y2MixWithBgImage:(UIImage *)bgImage coverImage:(UIImage *)coverImage coverRect:(CGRect)coverRect;

@end


